package com.yupi.cli;

import com.yupi.cli.command.ConfigCommand;
import com.yupi.cli.command.GenerateCommand;
import com.yupi.cli.command.ListCommand;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
// some exports omitted for the sake of brevity

@Command(name = "hezi", mixinStandardHelpOptions = true)
public class CommandExecutor implements Runnable {

    /**
     * 添加子命令
     */
    private final CommandLine commandLine;

    {
        commandLine = new CommandLine(this)
                .addSubcommand(new GenerateCommand())
                .addSubcommand(new ConfigCommand())
                .addSubcommand(new ListCommand());
    }
    @Override
    public void run() {
        /**
         * 不输入子命令时给出友好提示
         */
        System.out.println("请输入具体命令，或者输入 --help 查看命令提示");
    }
    /**
     * 执行命令
     */
    public Integer doExecute(String[] args){
        return commandLine.execute(args);
    }
}